/**
 * Created by yzdd on 2018/6/11.
 */
import React, {Component} from 'react';
import {
  View,
  Text,
  StyleSheet,
  Image,
  TextInput,
  Animated,
  Alert
} from 'react-native';
import {width, height} from '../utils/publiscStyle'
import {QRScannerView} from 'ac-qrcode';

const styles = StyleSheet.create({});

export default class ScanPage extends Component {
  static navigationOptions = ({navigation}) => {
    return ({
      title: '扫一扫',
    })
  }


  render() {
    return (
      <View style={{flex: 1}}>
        <QRScannerView
          style={{flex: 1}}
          rectWidth={280}
          rectHeight={280}
          scanBarImage={null}
          cornerColor={"#1DA1F2"}
          cornerBorderWidth={1}
          cornerBorderColor={"#1DA1F2"}
          onScanResultReceived={this.barcodeReceived.bind(this)}

          renderTopBarView={() => this._renderTitleBar()}

          renderBottomMenuView={() => this._renderMenu()}
        />
      </View>
    )
  }

  _renderTitleBar = () => {
    return (
      null
    );
  }

  _renderMenu = () => {
    return (
      null
    )
  }

  barcodeReceived(e) {
    Alert.alert('Type: ' + e.type + '\nData: ' + e.data);
    //console.log(e)
  }
}